/**
 * @Copyright:Copyright (c) 2007 - 2023
 * 
 */
package com.tengtong.duang.app.query.core;

import com.tengtong.commons.lang.StringUtils;

/**
 * 表达式函数名称及映射等
 *
 * @author lin_jinming
 * @since: v1.0
 */
public enum ExpressFunc {

    Eq("="),
    
    NEq("<>"),
    
    LT("<"),
    
    LE("<="),
    
    GT(">"),
    
    GE(">="),
    
    Like(""),
    
    EndWith(""),
    
    StartWith(""),
    
    In(""),
    
    NotIn(""),
    
    IsNull(""),         // is null 操作
    
    NotNull(""),         // is not null 操作
    
    Between("")
    ;
    
    private String op;
    
    /**
     * 
     */
    private ExpressFunc(String o) {
        this.op = o;
    }

    /**
     * @return the op
     */
    public String getOp() {
        return op;
    }
    
    public static ExpressFunc fromValue(String v) {
        for(var o: values()) {
            if(StringUtils.equalsIgnoreCase(v, o.name())) {
                return o;
            }
        }
        return null;
    }    
}
